<?php
include("config.php");

$sql = "select * from admin where name = 'admin'";
$ret = $mysql->fetch_array($mysql->query($sql));
$userinfo = $ret[0];

if(isset($_REQUEST['act']) && $_REQUEST['act'] == 'update'){
	$opwd = mysql_escape_string(trim($_REQUEST['old_pwd']));
	$npwd = mysql_escape_string(trim($_REQUEST['new_pwd']));
		
	if(md5($opwd) != $userinfo['password']){
		echo "<script type='text/javascript'>alert('修改失败！');location.href='memberMod.php'</script>";
		exit;
	}
	
	$sql = "UPDATE `admin` set `password` = '".md5($npwd)."' where `name` = 'admin'";
	$mysql->query($sql);
}
?>
<HTML>
<HEAD>
<TITLE>淘宝小赢家-订单系统</TITLE>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<LINK href="images/FONT.CSS" type="text/css" rel=stylesheet>
</HEAD>
<BODY text=#000000 bottomMargin=0 vLink=#000000 aLink=#000000 link=#000000 leftMargin=0 topMargin=0 rightMargin=0 marginheight="0" marginwidth="0">
<DIV align=center>
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD vAlign=top align=middle><TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD width="743" align=right vAlign=top>
<DIV align=right>
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
<TBODY>
<TR>
<TD vAlign=top>
<TABLE cellSpacing=0 cellPadding=0 width="100%" bgColor=#ffffff border="0" style="border-collapse: collapse" bordercolor="#111111">
<TBODY>
<TR>
  <TD bgColor=#FFFFFF>
	<form method="post" action="memberMod.php" name="memberMod">
	  <TABLE cellSpacing=0 borderColorDark=#eeeeee cellPadding=0 width="100%" borderColorLight=#aaaaaa border=0>
		<tbody> 
		  <tr bgcolor="#FFDBBD"> 
			<td colspan=2 bgcolor="#EEEEEE"> 
			  <table width="100%" background="memberimg/menu_bg.gif" border="0" cellspacing="0" cellpadding="0" align="left">
				<tr>
				  <td height="35" valign="bottom">
				  <table border="0" cellspacing="0" cellpadding="0">
					<tr>
					  <td width="20">&nbsp;</td>
					  <td width="88" height="27" align="center" background="memberimg/menu_bg_on.gif" class="neititle">会员资料修改</td>
					  <td width="642">&nbsp;</td>
					</tr>
				  </table></td>
				</tr>
			  </table></td>
			</tr>
		    <tr> 
				<td width=87 align="left" height="30" nowrap>
				会员帐号： admin </td>
			</tr>
			<tr> 
				<td width=87 align="left" height="30" nowrap>
				QQ：<?php echo $userinfo['qq'];?> </td>
			</tr>
		  <tr>
			<td width="656" height="26">
			  <font color="#FF0000">旧密码：</font> 
			  <input type="password" name="old_pwd" size="16" style="font-size: 9pt; border: 1px solid #7D85A2; background-color: #EFF5FB">
			  </td>
			</tr>
			<tr>
			<td width="656" height="26">
			  <font color="#FF0000">新密码：</font> 
			  <input type="password" name="new_pwd" size="16" style="font-size: 9pt; border: 1px solid #7D85A2; background-color: #EFF5FB">
			  </td>
			</tr>
		  <tr bgcolor="#FFDBBD"> 
			<td colspan="2" align="left" height="30" nowrap bgcolor="#EEEEEE"> 
			  <div align="center">
				<input type="hidden" name="act" value="update">
				<input type="submit" name="Submit2" value="修改" style="font-size: 9pt; border: 1px solid #7D85A2; background-color: #EFF5FB">
			  </div>
			  </td>
			</tr>
		  </tbody> 
		</table>
	</form>
	</TD></TR>
</TBODY></TABLE>
                    </TD></TR></TBODY></TABLE></DIV></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
</DIV></BODY></HTML>